<?php
		include("session.inc");	
		include("dbconn.inc");
		include("dbfuc.inc");	
		$user=$_SESSION["user"];
		$curid=$_SESSION["curid"];
		$dbconnection=$_SESSION["dbconnection"];		
	if(session_is_registered("dbconnection") )
	{
		if(($user!="") && (($curid!="") || ($curid!=0)))
		{

		$sql="";
		$cnt=0;$cslno=0;
		$cuser="";$cpass="";$status="";$cstatus="";$oldddate="";$ddate="";$oldmonth="";$dmonth="";$mon="";$bgcolor="";
?>
<html>
<head>
<title>inner</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
<!--
body {
	margin-left: 0px;
	margin-top: 0px;
	margin-right: 0px;
	margin-bottom: 0px;
}
.style1 {	font-size: 9px;
	font-family: Geneva, Arial, Helvetica, sans-serif;
	font-weight: bold;
}
.style7 {font-family: Geneva, Arial, Helvetica, sans-serif}
-->
</style>
<link href="stylesheet.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF">
<!-- ImageReady Slices (inner.psd) -->
<table id="Table_01" width="1003" border="0" cellpadding="0" cellspacing="0">
	<tr>
		<td colspan="10"><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="1003" height="167">
          <param name="movie" value="images/inner_header.swf">
          <param name="quality" value="high">
          <embed src="images/inner_header.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="1003" height="167"></embed>
	    </object></td>
	</tr>
	<tr>
		<td rowspan="2">
			<img src="images/inner_02.jpg" width="220" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_03.jpg" width="98" height="29" alt=""></td>
		<td>
			<img src="images/inner_04.jpg" width="44" height="6" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_05.jpg" width="47" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_06.jpg" width="54" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_07.jpg" width="102" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_08.jpg" width="96" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_09.jpg" width="124" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_10.jpg" width="106" height="29" alt=""></td>
		<td rowspan="2">
			<img src="images/inner_11.jpg" width="112" height="29" alt=""></td>
	</tr>
	<tr>
		<td>
			<img src="images/inner_12.jpg" width="44" height="23" alt=""></td>
	</tr>
	<tr>
		<td height="19" background="images/inner_15.jpg">&nbsp;</td>
		<td colspan="9" rowspan="2" valign="top" bgcolor="#FFFFFF"><p>&nbsp;</p>
          <table width="98%" align="center" cellpadding="0" cellspacing="0">
            <tr>
              <td><br>
<br>
<table width="755" border="1" align="center" cellpadding="2" cellspacing="2" bordercolor="#CCCCCC" bgcolor="#FFFFFF">
  <tr>
    <td colspan="7" bgcolor="#CCCCCC" class="style2"><div align="center">Coupon Details </div></td>
  </tr>
  <tr bgcolor="#BEE09C">
    <td width="41" bgcolor="#CCCCCC" class="style5"><div align="center"><span class="style5">SL No </span></div></td>
    <td width="98" bgcolor="#CCCCCC" class="style5"><div align="center">Coupon <br>
    Serial No </div></td>
    <td width="167" bgcolor="#CCCCCC" class="style5"><div align="center">Coupon User </div></td>
    <td width="162" bgcolor="#CCCCCC" class="style5"><div align="center">Coupon Password </div></td>
    <td width="139" bgcolor="#CCCCCC" class="style5"><div align="center">Date of Allotment </div></td>
    <td width="110" bgcolor="#CCCCCC" class="style5"><div align="center">Status</div></td>
  </tr>
<?php
		$sql="select N_SLNO,C_COUPON_NAME,C_COUPON_PASSWORD,C_STATUS,D_DATE from mlm_coupon_details WHERE n_id='$curid' ORDER BY D_DATE";
			$result=mysql_query($sql);
			$rownum=mysql_num_rows($result);
			while($rownum >0)
			{
				$cnt=$cnt+1;
				$rownum=$rownum-1;
				$slno=mysql_result($result,$rownum,"N_SLNO");
				$couponuser=mysql_result($result,$rownum,"C_COUPON_NAME");			
				$couponpassword=mysql_result($result,$rownum,"C_COUPON_PASSWORD");
				$status=mysql_result($result,$rownum,"C_STATUS");
				$ddate=mysql_result($result,$rownum,"D_DATE");

		if($status=="N")
			$cstatus="BALANCE";
		else if($status=="Y")
			$cstatus="<a href='couponuser_details.php?ctuser=$couponuser'>USED</a>";
?>
<?php
/*			
		dmonth=ddate.substring(3,5);
		if(dmonth.equals("01"))  
			mon="January";
		if(dmonth.equals("02"))  
			mon="February";
		if(dmonth.equals("03")) 
			mon="March";
		if(dmonth.equals("04"))  
			mon="April";	
		if(dmonth.equals("05"))
			mon="May";	
		if(dmonth.equals("06"))
			mon="June";	
		if(dmonth.equals("07")) 
			mon="July";	
		if(dmonth.equals("08")) 
			mon="August";	
		if(dmonth.equals("09"))
			mon="September";	
		if(dmonth.equals("10"))
			mon="October";	
		if(dmonth.equals("11"))
			mon="November";	
		if(dmonth.equals("12"))
			mon="December";	
		
		if(!oldmonth.equals(dmonth))
		{
%>
			<tr bgcolor="#FFFFDF">
			  <td colspan="7" class="style1"><%=mon%></td>
			</tr>
<%			
		}
		oldmonth=dmonth;			
		if(!oldddate.equals(ddate))
		{
%>
			<tr bgcolor="#FFFFDF">
			  <td colspan="7" bgcolor="#CCCCCC" class="style6"><%=ddate%></td>
			</tr>
<%			
		cnt=1;
		}
		oldddate=ddate;					
%>
*/	
?>  <tr bgcolor="#EAF4DF">
		<td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $cnt ?></div></td>
		<td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $slno ?></div></td>
		<td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $couponuser ?></div></td>
		<td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $couponpassword ?></div></td>
		<td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $ddate ?></div></td>
	    <td bgcolor="#FFFFFF" class="style3"><div align="center"><?php echo $cstatus ?></div></td>
	  </tr>
<?php
	}

	if($cnt==0)
	{
?>
		  <tr>
			<td colspan="7" bgcolor="#FFFFFF"><div align="center" class="style1">No Records Found </div></td>
		  </tr>
<?php
	}
?>
</table></td>
            </tr>
          </table>          
          <p>&nbsp;</p>
</td>
	</tr>
	<tr>
		<td valign="top" background="images/inner_15.jpg"><table width="95%" align="center" cellpadding="0" cellspacing="0">
          <tr>
            <td><div class="arrowlistmenu">
                <ul>
                  <li><a href="validation_success.php" class="style1 style7">Control Panal  </a></li>
                  <li><a href="registration_step1.php" class="style1">Registration</a></li>
                  <li><a href="geneology.php" class="style1">Geneology </a></li>
                  <li><a href="amount_transfer.php" class="style1">Amount Transfer  </a></li>
                  <li><a href="amount_transfer_details.php" class="style1">Transaction Details  </a></li>
                  <li><a href="pindetails.php" class="style7">Received Coupon Details  </a></li>
				  <li><a href="user_profile.php" class="style7">View Profile   </a></li>
				  <li><a href="change_password.php" class="style7">Password Change </a></li>
				  <li><a href="logout.php" class="style7">Logout  </a></li>
                </ul>
            </div></td>
          </tr>
        </table>	    <p>&nbsp;</p></td>
	</tr>
	<tr>
		<td colspan="10">
			<img src="images/inner_16.jpg" width="1003" height="23" alt=""></td>
	</tr>
</table>
<!-- End ImageReady Slices -->
</body>
</html>

<?php
		}	
    }
	else
	{
		$errormsg="*Your session is expeired please login again";
		header("location: index.php?error=$errormsg");
	}
?>	
